package com.enba.mallapi.module.area.controller.resp;

import com.enba.boot.core.utils.TreeNode;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.util.StringUtils;

@EqualsAndHashCode(callSuper = true)
@Data
public class AreaInfoTreeNodeResp extends TreeNode implements Serializable {
  private static final long serialVersionUID = 1L;

  public AreaInfoTreeNodeResp(String code, String parentCode, String name) {
    super(
        Long.valueOf(code),
        StringUtils.hasText(parentCode) ? Long.valueOf(parentCode) : null,
        name);
    this.code = code;
    this.parentCode = parentCode;
    this.name = name;
  }

  @ApiModelProperty("区域代码")
  private String code;

  @ApiModelProperty("区域名称")
  private String name;

  @ApiModelProperty("父级区域代码")
  private String parentCode;

  @ApiModelProperty("层级（1: 省, 2: 市, 3: 区/县，4:乡/镇）")
  private Integer level;
}
